package com.ss.android.article.base.ui;

import android.content.Context;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.animation.AlphaAnimation;
import android.view.animation.AnimationSet;
import android.view.animation.LinearInterpolator;
import android.view.animation.OvershootInterpolator;
import android.view.animation.ScaleAnimation;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import com.ss.android.article.browser.R;

public final class DiggAnimationView extends ImageView {
    ScaleAnimation mScaleAnimation;
    AnimationSet b;
    DisplayMetrics c;
    static int d;
    static int e;
    private int f;
    private ScaleAnimation g;
    private AlphaAnimation h;
    private OvershootInterpolator i;
    private LinearInterpolator j;

    static {
        DiggAnimationView.d = 0;
        DiggAnimationView.e = 0;
    }

    private DiggAnimationView(Context arg10) {
        super(arg10);
        this.f = R.drawable.m6;
        this.mScaleAnimation = new ScaleAnimation(0f, 1f, 0f, 1f, 1, 0.5f, 1, 0.5f);
        this.g = new ScaleAnimation(1f, 1.5f, 1f, 1.5f, 1, 0.5f, 1, 0.5f);
        this.h = new AlphaAnimation(1f, 0f);
        this.b = new AnimationSet(false);
        this.c = new DisplayMetrics();
        this.i = new OvershootInterpolator(2f);
        this.j = new LinearInterpolator();
        ((WindowManager)arg10.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getMetrics(this.c);
        com.ss.android.j.b.isNightModeToggled();
        this.a();
        this.mScaleAnimation.setInterpolator(this.i);
        this.mScaleAnimation.setDuration(300);
        this.g.setInterpolator(this.j);
        this.g.setDuration(100);
        this.h.setDuration(100);
        this.b.addAnimation(this.g);
        this.b.addAnimation(this.h);
        this.mScaleAnimation.setAnimationListener(new m(this));
        this.b.setAnimationListener(new n(this));
    }

    public static DiggAnimationView a(ViewGroup arg4) {
        DiggAnimationView v0_1;
        int v0 = ((arg4 instanceof RelativeLayout)) || ((arg4 instanceof LinearLayout)) || ((arg4 instanceof FrameLayout)) ? 1 : 0;
        if(v0 == 0) {
            v0_1 = null;
        }
        else {
            DiggAnimationView v1 = new DiggAnimationView(arg4.getContext());
            v1.setId(com.ss.android.article.browser.R.id.r);
            v0 = (arg4 instanceof LinearLayout) ? 8 : 4;
            v1.setVisibility(v0);
            v1.measure(View.MeasureSpec.makeMeasureSpec(0, 0), View.MeasureSpec.makeMeasureSpec(0, 0));
            DiggAnimationView.d = v1.getMeasuredWidth();
            DiggAnimationView.e = v1.getMeasuredHeight();
            arg4.addView(((View)v1), new ViewGroup.LayoutParams(DiggAnimationView.d, DiggAnimationView.e));
            v0_1 = v1;
        }

        return v0_1;
    }

    public final void a() {
        this.setImageDrawable(this.getResources().getDrawable(this.f));
    }
}

